﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace Managistics.Model.Mappings
{
    public class InputSheetOthersMap : ClassMap<InputSheetOthers>
    {

        public InputSheetOthersMap()
        {
            Schema(Constants._tblSchema);
            Table(Constants._tblInputSheetOthers);
            LazyLoad();

            Id(x => x.Id).GeneratedBy.Identity().Column("Id");

            Map(x => x.InputedDate).Column("InputedDate").Not.Nullable();

            Map(x => x.Year).Column("Year").Not.Nullable().Precision(10);
            Map(x => x.Month).Column("Month").Not.Nullable().Precision(10);
            Map(x => x.InputType).Column("InputType").Not.Nullable().Precision(5);
            Map(x => x.SupplierCode).Column("SupplierCode").Length(20);
            Map(x => x.CustomerCode).Column("CustomerCode").Length(20);
            Map(x => x.Department).Column("Department").Length(200);
            Map(x => x.Description).Column("Description");
            Map(x => x.EmployeeId).Column("EmployeeId").Not.Nullable().Length(20);
            Map(x => x.IsDeleted).Column("IsDeleted").Not.Nullable().Precision(3);
            Map(x => x.CreatedDate).Column("CreatedDate").Not.Nullable();
            Map(x => x.UpdatedDate).Column("UpdatedDate").Not.Nullable();

            HasMany(x => x.InputSheetOtherDetail).KeyColumn("InputSheetOtherId")
                .Inverse()
                .LazyLoad()
                .Cascade
                .AllDeleteOrphan();
            
        }
    }
}
